<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;
use yii\web\View;
use kartik\date\DatePicker;

/* @var $this yii\web\View */
/* @var $model app\models\MaterialborrowModel */
/* @var $form yii\widgets\ActiveForm */
$url=\Yii::getAlias('@web');
$js3=<<< Js
function myAjax(){
		var x=$("#materialborrowmodel-stu_id").val();
		$.ajax({
                    url: '$url/personinfo/getname?stuid='+x,
                    type: 'get',
                    dataType: 'text',
                    success: function (data) {
                       $("#materialborrowmodel-stu_name").val(data);
                    }
                });
}
Js;
$this->registerJs($js3, View::POS_END, 'myAjax');
?>

<div class="materialborrow-model-form">

    <?php $form = ActiveForm::begin(); ?>

    <?= $form->field($model, 'stu_id')->textInput(['maxlength' => true,
    		'onblur'=>'myAjax()',
    ]) ?>

   <?= $form->field($model, 'stu_name')->textInput(['maxlength' => true,
    		'readonly'=>true,
    ]) ?>

    <?= $form->field($model, 'activitytitle')->textInput(['maxlength' => true]) ?>

    <?= $form->field($model, 'material')->dropDownList($materials) ?>

    <?= $form->field($model, 'telephone')->textInput(['maxlength' => true]) ?>

    <?= $form->field($model, 'time')->widget(DatePicker::classname(), [
        'options' => ['placeholder' => '输入日期'],
        'pluginOptions' => [
            'autoclose'=>true,
            'format' => 'yyyy.mm.dd'
        ]
    ])->label('使用时间');
    ?>

    <?= $form->field($model, 'approved')->textInput(['maxlength' => true]) ?>

    <?= $form->field($model, 'remark')->textInput(['maxlength' => true]) ?>

    <div class="form-group">
        <?= Html::submitButton($model->isNewRecord ? '添加' : '修改', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
    </div>

    <?php ActiveForm::end(); ?>

</div>
